import { getDefaultFields } from '../utils';

module.exports = (app: Egg.Application) => {
	const DataTypes = app.Sequelize;

	const Model = app.model.define('qr', {
		id: {
			type: DataTypes.INTEGER({ length: 8 }).UNSIGNED,
			allowNull: false,
			primaryKey: true,
			autoIncrement: true
		},
		table_number: {
			type: DataTypes.STRING(30),
			allowNull: true,
			defaultValue: null,
			comment: '桌位号'
		},
		url: {
			type: DataTypes.STRING(255),
			allowNull: true,
			defaultValue: ''
		},
		...getDefaultFields()
	}, {
		tableName: 'qr',
		timestamps: false
	});

	Model.sync({ alter: true });

	// Model.associate = function() {
	// }

	return Model;
};
